<extend name="Public/user"/>
<block name="user-right">
<div class="user-right">
	<div class="user-head">
		<h2 style="display:inline-block;">{:lang('forecast')}</h2>
	</div>
	<style type="text/css">
		.addedcell{position: relative;}
		.addedcell .delcell{position: absolute;top: 1px;right: 0;display: block;background: red;color: #fff;padding: 2px 10px;height: 16px;line-height: 16px;}
		.listcell{position: relative;}
		.listcell .dellistcell{position: absolute;top: 1px;right: 0;display: block;background: red;color: #fff;padding: 2px 10px;height: 16px;line-height: 16px;}
		#addresslist{display: none;position: relative;}
	</style>
	<form method="post" action="{:url('')}" id="ybcartadd">
		<table class="yubao-add" cellpadding="0" cellspacing="0" style="line-height: 20px;border: none;" id="yubaoinput">
			<tr>
				<th width="100">{:lang('ex_num')}*</th>
				<th width="100">货物品名及数量*</th>
				<th width="70">{:lang('jiazhi')}(日元)</th>
				<th width="80">{:lang('baoguo_leixing')}</th>
				<!--
				<th width="75">原箱/合箱</th>
				-->
				<th width="">{:lang('remark')}</th>
			</tr>

			<tr>
				<td>
					<input type="text" name="kuaidi_sn[]"  placeholder="{:lang('ex_num')}"></td>
				<td>
					<input type="text" name="baoguo_name[]"  placeholder="货物品名及数量"></td>
				<td>
					<input type="text" name="jiazhi[]"  onkeyup="fillNumOnly(this)"   placeholder="{:lang('jiazhi')}(日元)"></td>
				<td>
					<select name="baoguo_type[]">
						<option value="0">{:lang('common_goods')}</option>
						<option value="1">{:lang('sensitive_goods')}</option>
					</select>
				</td>
				<!--
				<td>
					<select name="is_chaibao[]">
						<option value="0">原箱</option>
						<option value="1" selected>合箱</option>
					</select>
				</td>
				-->

				<td>
					<input type="text" name="remark[]" placeholder="{:lang('remark')}"></td>
			</tr>

		</table>
		<div class="blank"></div>
		<div style="width: 200px;text-align: center;margin: 0 auto;">
			<a href="###" class="btnqx addonecell">{:lang('add_cell')}</a>
			<a href="###" class="btnqd ybcartinbtn">{:lang('insert_yubao')}</a>
		</div>
	</form>
				<!-- <div class="blank"></div>
				<div class="fengenav">{:lang('import_excel')}</div>
				<div style="padding: 20px;">
					
					<table class="yubao-add" cellpadding="0" cellspacing="0" style="line-height: 20px;">
						<tr>
							<th>{:lang('download_excel')}：<a href="/Uploads/daiyunexcel.xls" style="color:red;">{:lang('download')}</a></th>
						
						</tr>
						<tr>
							<td align="center" style="padding: 10px;">
								<form action="{:url('excelin')}" method="post" enctype="multipart/form-data">
									<input type="file" name="excel">
									<input type="submit" value="{:lang('submit')}">
								</form>
							</td>
						</tr>

					</table>
				
				<div class="blank"></div>
				
				
			</div>
			<div class="blank"></div>
				<div class="fengenav">Excel批量下单</div>
				<div style="padding: 20px;">
					
					<table class="yubao-add" cellpadding="0" cellspacing="0" style="line-height: 20px;">
						<tr>
							<th>{:lang('download_excel')}：<a href="/Uploads/dingdaninsert.xls" style="color:red;">{:lang('download')}</a></th>
						
						</tr>
						<tr>
							<td align="center" style="padding: 10px;">
								<form action="{:url('dingdanexcelin')}" method="post" enctype="multipart/form-data">
									<input type="file" name="excel">
									<input type="submit" value="{:lang('submit')}">
								</form>
								<br>
								批量下单需严格按照所提供格式填写，如出错，请自行修改。
							</td>
						</tr>

					</table>
				
				<div class="blank"></div>
				
				
			</div> -->

</div>

<script type="text/javascript">
function fillNumOnly(obj) {
    var str = obj.value;
    if (str.trim == "")
        return;
    if (/[^0-9]/g.test(str)) {
        obj.value = str.substr(0, str.length - 1);
    }
}
</script>
<script type="text/javascript">
	$(function(){

		$('.ybcartinbtn').click(function(){
			$('#ybcartadd').submit();
		})
		$('.addonecell').click(function(){
			var html='<tr><td><input type="text" name="kuaidi_sn[]"  placeholder="{:lang(\'ex_num\')}"></td><td><input type="text" name="baoguo_name[]"  placeholder="货物品名及数量"></td><td><input type="text" onkeyup="fillNumOnly(this)"   name="jiazhi[]"  placeholder="{:lang(\'jiazhi\')}(日元)"></td><td><select name="baoguo_type[]"><option value="0">{:lang(\'common_goods\')}</option><option value="1">{:lang(\'sensitive_goods\')}</option></select></td><td><select name="is_chaibao[]"><option value="0">原箱</option><option value="1" selected>合箱</option></select></td><td  class="addedcell"><input type="text" name="remark[]" placeholder="{:lang(\'remark\')}"><a href="###" class="delcell">{:lang(\'delete\')}</a></td></tr>';
			$('#yubaoinput').append(html);
		})
		$(document).on('click','.delcell',function(){
			$(this).parents('tr').remove();
		})
		$('form#ybcartadd').submit(function(){
			var self = $(this);
				$.post(self.attr("action"), self.serialize(), success, "json");
				return false;
				function success(data){
					if (data.status) {
						$.thinkbox.success(data.info);
						setTimeout(jumpurl(data.url),1500);
					}else{
						$.thinkbox.error(data.info);
					};
				}
		})
	})
</script>
</block>